package com.jwsoft.manager.core.gateway.controller;

import com.bifang.assistant.common.constants.Validators;
import com.bifang.engine.assistant.core.domain.AppResponse;
import com.bifang.engine.protect.core.annotation.Idempotent;
import com.github.pagehelper.PageInfo;
import com.jwsoft.manager.common.vo.eduHouseInterfaceData.EduHouseInterfaceDataKeyVO;
import com.jwsoft.manager.common.vo.eduHouseInterfaceData.EduHouseInterfaceDataQueryVO;
import com.jwsoft.manager.common.vo.eduHouseInterfaceData.EduHouseInterfaceDataVO;
import com.jwsoft.manager.core.integration.EduHouseInterfaceDataIntegration;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 房产接口数据表网关
 *
 * @author hhj
 * @since 2023-01-03
 */
@RestController
@RequestMapping(value = "/doc/api")
@Tag(name = "房产接口数据表", description = "房产接口数据表")
public class EduHouseInterfaceDataController {

    @Autowired
    public EduHouseInterfaceDataIntegration eduHouseInterfaceDataIntegration;

    @Operation(summary = "房产接口数据表分页查询",description = "房产接口数据表分页查询")
    @PostMapping(value = "/EduHouseInterfaceData0001", produces = "application/json;charset=UTF-8")
    public AppResponse<PageInfo<EduHouseInterfaceDataVO>> getList(@RequestBody @Validated EduHouseInterfaceDataQueryVO vo) {
        return AppResponse.successData(eduHouseInterfaceDataIntegration.getList(vo));
    }

    @Operation(summary = "房产接口数据表根据主键查询详情",description = "房产接口数据表根据主键查询详情")
    @PostMapping(value = "/EduHouseInterfaceData0002", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseInterfaceDataVO> getById(@RequestBody @Validated EduHouseInterfaceDataKeyVO vo) {
        return AppResponse.successData(eduHouseInterfaceDataIntegration.getById(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产接口数据表新增",description = "房产接口数据表新增")
    @PostMapping(value = "/EduHouseInterfaceData0004", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseInterfaceDataVO> add(@RequestBody @Validated(value = {Validators.Add.class}) EduHouseInterfaceDataVO vo) {
        return AppResponse.successData(eduHouseInterfaceDataIntegration.add(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产接口数据表修改",description = "房产接口数据表修改")
    @PostMapping(value = "/EduHouseInterfaceData0005", produces = "application/json;charset=UTF-8")
    public AppResponse<EduHouseInterfaceDataVO> edit(@RequestBody @Validated(value = {Validators.Edit.class}) EduHouseInterfaceDataVO vo) {
        return AppResponse.successData(eduHouseInterfaceDataIntegration.edit(vo));
    }

    @Idempotent(expire="PT2S") //2秒内防重复提交
    @Operation(summary = "房产接口数据表删除",description = "房产接口数据表删除")
    @PostMapping(value = "/EduHouseInterfaceData0006", produces = "application/json;charset=UTF-8")
    public AppResponse del(@RequestBody @Validated EduHouseInterfaceDataKeyVO vo) {
        eduHouseInterfaceDataIntegration.del(vo);
        return AppResponse.successMsg("删除成功！");
    }
}
